{% macro discards(interface, bi_id, device, id) -%}

{
  "cacheTimeout": null,
  "colorBackground": false,
  "colorValue": false,
  "colors": [
    "rgba(245, 54, 54, 0.9)",
    "rgba(237, 129, 40, 0.89)",
    "rgba(50, 172, 45, 0.97)"
  ],
  "datasource": null,
  "editable": true,
  "error": false,
  "format": "none",
  "gauge": {
    "maxValue": 100,
    "minValue": 0,
    "show": false,
    "thresholdLabels": false,
    "thresholdMarkers": true
  },
  "height": "50",
  "id": {{ id }},
  "interval": null,
  "isNew": true,
  "links": [],
  "mappingType": 1,
  "mappingTypes": [
    {
      "name": "value to text",
      "value": 1
    },
    {
      "name": "range to text",
      "value": 2
    }
  ],
  "maxDataPoints": 100,
  "nullPointMode": "connected",
  "nullText": null,
  "postfix": "",
  "postfixFontSize": "50%",
  "prefix": "",
  "prefixFontSize": "50%",
  "rangeMaps": [
    {
      "from": "null",
      "text": "N/A",
      "to": "null"
    }
  ],
  "span": 3,
  "sparkline": {
    "fillColor": "rgba(31, 118, 189, 0.18)",
    "full": false,
    "lineColor": "rgb(31, 120, 193)",
    "show": false
  },
  "targets": [
    {
      "refId": "A",
      "resultFormat": "time_series",
      "intervalFactor": 1,
      "query": "SELECT $timeSeries as t, avg(discards_out) FROM $table WHERE managed_object ={{bi_id}} and path[4]=toString('{{interface}}') and $timeFilter GROUP BY t ORDER BY t",
      "database": "noc",
      "tableLoading": false,
      "table": "interface",
      "dateLoading": false,
      "datetimeLoading": false,
      "dateColDataType": "date",
      "dateTimeColDataType": "ts"
    }
  ],
  "thresholds": "",
  "title": "Discards out {{device}}",
  "type": "singlestat",
  "valueFontSize": "80%",
  "valueMaps": [
    {
      "op": "=",
      "text": "N/A",
      "value": "null"
    }
  ],
  "valueName": "avg"
}
{%- endmacro %}
